package cn.koala.key.receipt.controller;

import cn.koala.key.api.KeyManagementApi;
import cn.koala.key.common.feign.FeignUtils;
import cn.koala.key.receipt.vo.CarInfoVO;
import cn.koala.key.receipt.vo.CarType;
import cn.seed.common.core.Result;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 32415
 * @time 2019/5/6
 **/
@RestController
public class CarController {
    /**
     * @Description: 模糊查询车牌车架信息
     *
     * @param
     * @return Object
     * @throws
     * @exception:
     * @author: 32415
     * @time: 2019/5/7 15:34
     */
    @GetMapping("/cars")
    public Result<List<CarInfoVO>> getCarLike(@ApiParam("车牌") @RequestParam(required = false, defaultValue = "") String carNo,
                                              @ApiParam("车架") @RequestParam(required = false, defaultValue = "") String carVin,
                                              @ApiParam("0-根据车牌模糊，1-根据车架模糊") Integer order) {

        return FeignUtils.getHttpApi(KeyManagementApi.class).getCars(carNo, carVin, order);
    }

    @GetMapping("/cars/car-type")
    public Result<List<CarType>> getCars(Integer carType) {
        return FeignUtils.getHttpApi(KeyManagementApi.class).getCarsbyCarTypes(carType);
    }
}
